import 'package:flutter/material.dart';
import './myicons.dart';
import './homepage.dart';
import './bookpage.dart';
import './blocpage.dart';
import './videopage.dart';
import './minepage.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class BottomTab extends StatefulWidget {
  BottomTab({Key key}) : super(key: key);

  @override
  _BottomTabState createState() => _BottomTabState();
}

class _BottomTabState extends State<BottomTab> {
  int _currentIndex = 0;
  List _bottomtabList = [
    HomePage(),
    BookPage(),
    BlocPage(),
    VideoPage(),
    MinePage(),
  ];
  var searchres;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color.fromRGBO(242, 242, 242, 1),
        actions: <Widget>[
          IconButton(
              icon: Icon(Icons.settings),
              onPressed: () {
                print("ss");
              })
        ],
        elevation: 0,
        title: Container(
          child: TextField(
            style: TextStyle(color: Color.fromRGBO(153, 153, 153, 1)),
            decoration: InputDecoration(
              icon: Icon(Icons.search),
              hintText: "输入搜索内容",
              border: InputBorder.none,
              fillColor: Color.fromRGBO(242, 242, 242, 0),
            ),
            controller: searchres,
            onChanged: (value) {
              print(value);
            },
          ),
        ),
      ),
      body: this._bottomtabList[this._currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: this._currentIndex,
        onTap: (int index) {
          setState(() {
            this._currentIndex = index;
          });
        },
        type: BottomNavigationBarType.fixed,
        items: [
          BottomNavigationBarItem(
            // icon: Image.asset('assets/images/bottomicons/home_icon.png'),
            icon: Icon(MyIcons.home),
            title: Text("首页"),
          ),
          BottomNavigationBarItem(
            // icon: Image.asset('assets/images/bottomicons/book_icon.png'),
            icon: Icon(MyIcons.book),
            title: Text("手册"),
          ),
          BottomNavigationBarItem(
            // icon: Image.asset('assets/images/bottomicons/bloc_icon.png'),
            icon: Icon(MyIcons.blog),
            title: Text("博客"),
          ),
          BottomNavigationBarItem(
            // icon: Image.asset('assets/images/bottomicons/video_icon.png'),
            icon: Icon(MyIcons.video),
            title: Text("视频"),
          ),
          BottomNavigationBarItem(
            // icon: Image.asset('assets/images/bottomicons/mine_icon.png'),
            icon: Icon(MyIcons.mine),
            title: Text("我的"),
          ),
        ],
      ),
    );
  }
}
